package com.atguigu.gulimall.product.dao;

import java.util.List;

import com.atguigu.gulimall.product.entity.AttrGroupEntity;
import com.atguigu.gulimall.product.vo.SpuItemAttrGroupVo;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;


/**
 * 属性分组
 * 
 * @author leifengyang
 * @email leifengyang@gmail.com
 * @date 2019-10-01 21:08:49
 */
@Mapper
public interface AttrGroupDao extends BaseMapper<AttrGroupEntity> {
    @Select("SELECT a.*,b.name as catelogName from ( select * from `pms_attr_group` ${ew.customSqlSegment}) a left join `pms_category` b on  a.catelog_id=b.cat_id ")
    IPage<AttrGroupEntity> selectAttrGroupWithCatelogName(IPage<AttrGroupEntity> page, @Param("ew") Wrapper<AttrGroupEntity> wrapper);

    List<SpuItemAttrGroupVo> getAttrGroupWithAttrsBySpuId(@Param("spuId") Long spuId, @Param("catalogId") Long catalogId);

}
